{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">卡板列表</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                   data-auth-add="{:$auth->check('banner.banner/add')}"
                   data-auth-edit="{:$auth->check('banner.banner/edit')}"
                   data-auth-delete="{:$auth->check('banner.banner/del')}"></table>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/html" id="picTpl">
    <img style="max-width:100px; max-height:60px;" src="{{d.img}}" data-image="{{d.title}}">
</script>

<script type="text/html" id="barTool">
<!--    {if $userInfo['roleid']==1}-->
    {{# if(d.is_bk==0){ }}
    <a class="layui-btn layui-btn-xs" data-open='{:url("edit")}?id={{ d.id }}' data-title="编辑内容">编辑</a>
<!-- data-full="true"-->

    <a href='{:url("del",["catid"=>$catid])}?ids={{ d.id }}'
       class="layui-btn layui-btn-danger layui-btn-xs layui-tr-del">删除</a>
    {{# } }}
<!--    {/if}-->
</script>

<script type="text/html" id="statusTpl">
    <input type="checkbox" name="status" data-href='{:url("setstate")}?id={{d.id}}' value="{{d.id}}"
           lay-skin="switch"
           lay-text="启动|关闭" lay-filter="switchStatus" {{ d.status==1 ? 'checked' : '' }}>
</script>

<script type="text/javascript">
    layui.use('yznTable', function () {
        var table = layui.yznTable;
        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: '{:url("add")}',
            edit_url: '{:url("edit")}',
            delete_url: '{:url("del")}',
        };
        table.render({
            init: init,
            toolbar: ['refresh'],
            // toolbar: ['refresh'],
            url: '{:url("index")}?sq_id={$sq_id}',
            search: true,
            cols: [
                [
                    //名称 水票背景图 所属商品分类 所属商品
                    {field: 'id', with: '8%', title: 'ID'},
                    {field: 'sim', align: "center", width: '20%',  title: 'SIM号', searchOp: 'like'},
                    // {field: 'phone', align: "center", width: '10%',  title: '绑定手机号', searchOp: 'like'},

                    // {field: 'jh_time', align: "center", width: '15%', title: '激活时间', search: 'range'},
                    {field: 'shop_name', align: "center", width: '10%',  title: '申请门店', search: false},
                    {
                        field: 'is_bk', width: '10%', align: "center", title: '划拨状态', templet: function (d) {
                            if (d.is_bk == 0) {
                                return '<span style="color: green">未划拨</span>';
                            } else {
                                return '<span style="color: #2A57FE">已划拨</span>';
                            }
                        }, selectList: {0: '未划拨', 1: '已划拨'}
                    },

                    // {
                    //     field: 'status', width: '8%', align: "center", title: '激活状态', templet: function (d) {
                    //         if (d.status == 0) {
                    //             return '<span style="color: green">未激活</span>';
                    //         } else {
                    //             return '<span style="color: #2A57FE">已激活</span>';
                    //         }
                    //     }, selectList: {0: '未激活', 1: '已激活'}
                    // },
                    // {
                    //     field: 'use_status', width: '8%', align: "center", title: '使用状态', templet: function (d) {
                    //         if (d.use_status == 0) {
                    //             return '<span style="color: green">未使用</span>';
                    //         } else if (d.use_status == 1) {
                    //             return '<span style="color:  #2A57FE">正常使用</span>';
                    //         } else if (d.use_status == 2) {
                    //             return '<span style="color: #cf9236">欠费</span>';
                    //         } else if (d.use_status == 3) {
                    //             return '<span style="color: black">停机</span>';
                    //         } else if (d.use_status == 4) {
                    //             return '<span style="color: red">涉诈</span>';
                    //         }
                    //     }, selectList: {0: '未使用',1: '正常使用',2: '欠费', 3: '停机',4: '涉诈'}
                    // },

                    {field: 'create_time', align: "center", width: '15%', title: '申请时间', search: 'range'},
                    {field: 'bk_time', align: "center", width: '15%', title: '划拨时间', search: 'range'},
                    {field: 'hb_time', align: "center", width: '15%', title: '收货时间', search: 'range'},

                    // {fixed: 'right', width: '5%', align: "center", title: '操作', toolbar: '#barTool'}
                ]
            ],
            page: {}
        });

        yznTable.bindevent();
    });
</script>
{/block}